power: Explicitly select pmic device's bus
authorAaron Durbin <[email protected]>
Tue, 20 May 2014 12:01:38 +0000 (06:01 -0600)
committerMinkyu Kang <[email protected]>
Wed, 28 May 2014 01:58:19 +0000 (10:58 +0900)
The current pmic i2c code assumes the current i2c bus is
the same as the pmic device's bus. There is nothing ensuring
that to be true. Therefore, select the proper bus before performing
a transaction.

Signed-off-by: Aaron Durbin <[email protected]>
Signed-off-by: Simon Glass <[email protected]>
Acked-by: Heiko Schocher <[email protected]>
Reviewed-by: Simon Glass <[email protected]>
Signed-off-by: Minkyu Kang <[email protected]>
drivers/power/power_i2c.c

index ac768708eadf22aacc4f2e6e15c66d07a5c248f5..594cd11725e982c9bea441effb1a0c25f3028745 100644 (file)
@@ -23,6 +23,8 @@ int pmic_reg_write(struct pmic *p, u32 reg, u32 val)
        if (check_reg(p, reg))
                return -1;
 
+       I2C_SET_BUS(p->bus);
+
        switch (pmic_i2c_tx_num) {
        case 3:
                if (p->sensor_byte_order == PMIC_SENSOR_BYTE_ORDER_BIG) {
@@ -66,6 +68,8 @@ int pmic_reg_read(struct pmic *p, u32 reg, u32 *val)
        if (check_reg(p, reg))
                return -1;
 
+       I2C_SET_BUS(p->bus);
+
        if (i2c_read(pmic_i2c_addr, reg, 1, buf, pmic_i2c_tx_num))
                return -1;